From: Jasper St. Pierre Date: Mon, 4 Jun 2012 22:43:52 +0000 (-0400) Subject: extensionSystem: Make the init function optional X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~6480 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=0805d7a35ffa06a5d4b99f9a0e0cd38ac6c6a786;p=gnome-shell.git extensionSystem: Make the init function optional A large amount of extensions have something like this in them: function init() {} Since we have encouraged extension authors to try and not make any changes in init, it feels weird and strange to have to create an initialization function that does nothing. From now on, don't require it. https://bugzilla.gnome.org/show_bug.cgi?id=677586 --- diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js index cb205a7f2..35b02a482 100644 --- a/js/ui/extensionSystem.js +++ b/js/ui/extensionSystem.js @@ -190,16 +190,13 @@ function initExtension(uuid) { return; } - if (!extensionModule.init) { - logExtensionError(uuid, 'missing \'init\' function'); - return; - } - - try { - extensionState = extensionModule.init(extension); - } catch (e) { - logExtensionError(uuid, 'Failed to evaluate init function:' + e); - return; + if (extensionModule.init) { + try { + extensionState = extensionModule.init(extension); + } catch (e) { + logExtensionError(uuid, 'Failed to evaluate init function:' + e); + return; + } } if (!extensionState)